//
//  FMDBManager.h
//  FMDBDemo
//
//  Created by YY on 16/10/16.
//  Copyright © 2016年 CheDan. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "F.h"
#import "Member.h"
#import "Score.h"


typedef NS_OPTIONS(NSUInteger, SQLState) {
    SQLStateNone = 0,
    SQLStateInnerJoin,        //内联  inner join
    SQLStateLeftOuterJoin ,   //左联  left outer join
    SQLStateRightOuterJoin,   //右联  right outer join
    SQLStateFullOuterJoin     //全联  full outer join

} NS_ENUM_AVAILABLE_IOS(7_0);



@interface FMDBManager : NSObject

@property (nonatomic,assign)SQLState sqlState;

+ (instancetype)shareManager;

- (void)createTable;

- (void)inserMember:(Member *)model;

- (void)inserF:(F *)model;

- (void)inserScore:(Score *)model;

- (NSString *)dbPath;

- (NSArray<Member *> *)executeNeiLianSql;

/*
 
 @"SELECT * from Member inner join Score on Member.MID = Score.MID"
 
 tableName -> Member
 state -> SQLStateInnerJoin
 queryString -> Member.MID = Score.MID
 
 */
- (NSArray<Member *> *)querySQLStringWithTableNameSQLStringWithTableName:(NSString *)tableName
                                   state:(SQLState)state
                          querySQLString:(NSString *)queryString;

@end
